import {
  defineConfig
} from 'vite'
import vue from '@vitejs/plugin-vue'
import {
  resolve
} from 'path'
import copy from 'rollup-plugin-copy'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), copy({
    targets: [
      // { src: 'node_modules/@liveqing/liveplayer-v3/dist/component/liveplayer-lib.min.js', dest: 'public/js' },
    ]
  })],
  build: {
    outDir: 'dist_suhexi', // 打包文件的输出目录
    assetsDir: 'static', // 静态资源的存放目录
  },
  base: './', // 静态资源路径
  minify: true, // 是否压缩代码
  sourceMap: true, // 是否生成sourceMap
  target: 'browser',
  resolve: {
    alias: {
      '@': resolve(__dirname, './src') // +++
    },
    extensions: ['.vue', '.js', '.json']
  },
  server: {
    host: true,
    proxy: {
      '/api': {
         target: 'http://47.97.10.116:8071',
        //target: 'http://127.0.0.1:8071',
        //target: 'http://116.62.47.112:8090',
        //target: 'http://localhost:8071',
        //target: 'https://5w096565q2.zicp.fun',
        changeOrigin: true,
      },
      '/static': {
        target: 'http://hm_lean.invix.tech:8070',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/static/, ''),
      },
    },
  },
})